﻿@model Etest.Models.QuestionViewModel
@{
    ViewBag.Title = "NextQuestion";
    ViewData.TemplateInfo.HtmlFieldPrefix = ""; 
}

<h2>NextQuestion</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<div class="test-page">
    @using (Html.BeginForm("EvaluateTest", "Test", new { generatedTestId = Model.generatedId }))
    {
        <input type="submit" value="Kraj na testot" />
    }
    @using (Html.BeginForm("NextQuestion", "Test", FormMethod.Post))
    {
        <div class="marked-questions">
            @for (int i = 0; i < Model.markedQuesionIndices.Count; i++)
            {
                <!-- na ovoj nacin se pravi model binding kaj listi -->
                @Html.HiddenFor(mo => mo.markedQuesionIndices[i])
                if (i % 3 == 0)
                {
                    <br />
                }
                <a href="@Url.Action("NextQuestion", new { generatedTestId = Model.generatedId, qIdIndex = i })">
                    @if (Model.markedQuesionIndices[i] != -1)
                    {
                        @i<img src="@Url.Content("~/Content/themes/base/images/green-circle.png")" />
                    }
                    else
                    {
                        @i<img src="@Url.Content("~/Content/themes/base/images/red-circle.png")" />
                    }
                </a>
            }
        </div>

        <div class="test-question">

            <fieldset>
                <legend>QuestionViewModel</legend>

                @Html.HiddenFor(model => model.generatedId)
                @Html.HiddenFor(model => model.question.id)
                @Html.HiddenFor(model => model.qId)
                @Html.DisplayFor(model => model.question.question_text)

                <!-- @Html.EditorFor(model => model.options) -->
                <!-- @Html.EditorFor(model => model.selectedOptions) -->
                <!-- pravi vaka za sporedba -->
                @for (int i = 0; i < Model.options.Count; i++)
                {
                    @Html.HiddenFor(model => model.options[i].id)
                    <br />
                    if (Model.options[i].checkbox_or_ratio == true)
                    {
                    @Html.CheckBoxFor(model => model.selectedOptions[i])
                    }
                    else
                    {
                    @Html.RadioButtonFor(model => model.selected, i)
                    }
                    @Html.DisplayFor(model => model.options[i].option_text)
                }

                <p>
                    <input type="submit" value="Next" />
                </p>

            </fieldset>

        </div>
    }
</div>
